package com.yuanfud.user.controller;

import com.yuanfud.common.exception.RestException;
import com.yuanfud.common.util.ErrorCode;
import com.yuanfud.common.util.ResultBody;
import com.yuanfud.entity.user.WebsiteConfig;
import com.yuanfud.user.service.WebsiteInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/index")
public class indexController {
    @Autowired
    WebsiteInfoService websiteInfoService;
    @RequestMapping(value="/website",method = RequestMethod.GET)
    public ResultBody<WebsiteConfig> index() throws RestException {
        ResultBody<WebsiteConfig> resultBody=new ResultBody<>();
        resultBody.setCode(ErrorCode.SUCCESS_OK);
        resultBody.setMsg(ErrorCode.SUCCESS_OK_MSG);
        resultBody.setData(websiteInfoService.getWebsiteInfo());
        return resultBody;
    }
}
